package cn.lifei.basic.listener;

import cn.lifei.auth.service.IPermissionScanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.ContextLoaderListener;

import javax.servlet.ServletContextEvent;
import javax.servlet.annotation.WebListener;

@WebListener
public class PermissionListener extends ContextLoaderListener {
    @Autowired
    private IPermissionScanService permissionScanService;

    @Override
    public void contextInitialized(ServletContextEvent event) {
        System.out.println("监听器工作");
        //扫描（要先拿到接口，也就是Controller）
        permissionScanService.scan();
        System.out.println("监听器结束");
    }
}
